var baseApi='/api';

layui.config({
    base: '/static/js/', //假设这是你存放拓展模块的根目录  //静态资源所在路径
    version: true//一般用于更新模块缓存，默认不开启。设为true即让浏览器不缓存。也可以设为一个固定的值，如：201610
    // version: '20190510'
}).extend({
    admin: 'admin',                          //平台初始化模块
    moduleApi: 'api/dev.env',                   // 模块环境标识
    nav: 'api/nav',                             //导航接口api
    user: 'api/user',                        // 用户相关api
    drawing: 'api/upload/drawing',              //图纸相关api
    project: 'api/project/project',            //项目相关api
    registe: 'api/registe/registe',            //保存登记成果
    specialTree: 'api/registe/specialTree',    //专业类别（树形）
    workDeal: 'api/reviewUnit/workDeal',      //工作分配api
    bsColor: 'api/reviewUnit/bsColor',      //获取列表标识颜色
    replaceStr: 'api/project/replaceStr',      //替换dom中的项目，标段，单位工程名称
    deal: 'api/deal/deal',                     //一窗受理，三方受理
    suggest: 'api/checkDrawing/suggest',     //意见api接口模块
    suggestBase: 'api/checkDrawing/suggestBase',     //意见库api接口模块
    reviewUnit: 'api/reviewUnit/reviewUnit',  //图纸签章 审查结果
    checkDrawing: 'api/checkDrawing/checkDrawing',   //专家审图模块
    uploadCommon: 'api/uploadCommon',   //上传图纸
    peopleDefense: 'api/reviewUnit/peopleDefense',   //人防专家管理
    panel: 'api/panel/panel',         //panel页基本组件,

    configure: 'config/configure',            //公共配置信息
    configureCom: 'config/configureCom',     //公共配置方法

    permission: 'utils/permission',           //权限验证
    sessionFun: 'utils/sessionFun',           //存取session模块（依赖storage）
    storage: 'utils/storage',                  //封装storage底层模块
    templateInit: 'utils/templateInit',        //组件初始化模块
    bluebird: 'utils/bluebird.min',             //ie兼容promise模块
    dataFormat: 'utils/dataFormat',             //数据格式化模块
    treetable: 'utils/treetableLay/treetable', //图纸树模块
    serializeObject: 'utils/serializeObject', //表单序列化
    selectFun: 'utils/selectFun',               //省市区联调
    keyUp: 'utils/keyFun',                       //键盘事件返回值
    tabHeight: 'utils/tabHeight',               //标签栏计算高度
    allHeight: 'utils/allHeight',               //所有标签&内容区域计算高度
    message: 'utils/message',                      //通信机制
    ieTest: 'utils/ieTest',                      //检测是否ie浏览器（不是-1，就为ie浏览器）
    mxDraw: 'utils/drawing/mxDraw',             //加载dwg
    pdf: 'utils/drawing/pdf',                      //加载pdf
    pdfXiaoling: 'utils/drawing/pdfXiaoling',     //加载pdf
    ztree: 'utils/ztree/ztree',                   //ztree树
    ztreeBase: 'utils/ztree/ztreeBase',     //ztree基础树
    matchType: 'utils/matchType/matchType',    //判断文件类型
    matchDict: 'utils/matchDict/matchDict',    //匹配字典表
    json: 'utils/json2',                         //json格式转换
    timeFun: 'utils/timeFun',                         //时间按年季月选择方法
    bodyTab: 'utils/bodyTab',                         //标签方法
    navBar: 'utils/navBar',                         //标签方法
    xadmin: 'xadmin',                         //标签方法
    uploadDrawing: 'utils/upload/uploadDrawing',         //图纸上传模块
    treetable1: 'utils/treetable1',         //图纸树模块
    treeSelect: 'utils/treeSelect',         //树形下拉框
    tableMerge: 'utils/tableMerge/tableMerge',    //表格合并单元格
    baseTab: 'utils/baseTab/baseTab',         //标签页模块初始化组件
    process: 'utils/process/process-xl',         //流程引擎模块
    jsDictFile: 'utils/jsDictFile',//后台数据字典
    jsDictFileStatic: 'utils/jsDictFileStatic',//前端业务字典

    roleNav: 'component/roleNav',              //角色导航基础组件
    specialty: 'component/upload/specialtyList', //图纸树模板

    layerPop: 'utils/layerPop',                  //引用layui封装弹窗模块

    accept: 'api/surveyUnit/survey/accept',      //承接接口api
    gain: 'api/buildUnit/gain/gain',             //成果确认接口api
    confirmGain: 'api/surveyUnit/gainManage/confirmGain',      //勘察设计院确认接口api

    reportMateriaEdit: 'component/templates/reportMateriaEdit',      //报审材料编辑模板
    reportMateriaDetail: 'component/templates/reportMateriaDetail',      //报审材料详情模板
    organList: 'component/templates/organList',     //机构选择组件
    unReportedApply: 'component/buildUnit/applyManage/unReportedApply',//未报审组件
    reportedApply: 'component/buildUnit/applyManage/reportedApply',//已报审组件
    apply: 'api/buildUnit/apply/apply',//报审接口
    singleProjectInfoDetail: 'component/templates/singleProjectInfoDetail',//单位工程详情组件
    templates: 'api/templates/templates',//模板接口地址

    sgProjItemFile: '../../api/dict/value/sgProjItemFile',//单位工程属性json
    technologyLeader: 'api/technologyLeader/technologyLeader',//技术负责人组件
    reviewExamineAPI: 'api/surveyUnit/reviewExamine/reviewExamineAPI',//复审接口组件
    mapExtend: 'utils/mapExtend',//地图基本组件

    echartsCom:'echartsCom',//echarts  公共js

    //TODO:第三方组件（从外部引入的模块第三方组件，全部放在此处）
    easyUi: 'utils/easyUi/jquery.easyui.min'  //easyui第三方组件
});
/*

function loadScript(url, apikey) {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src = url;
    script.setAttribute("apikey", apikey);
    document.body.appendChild(script);
}

loadScript("https://js.fundebug.cn/fundebug.1.5.1.min.js", "1fdc2ea7cdc9225ba2e48b9309609a8d66b3c1c7c9bcd5efcf8540c05770d83c");

*/

//处理键盘事件 禁止后退键（Backspace）密码或单行、多行文本框除外
function forbidBackSpace(e) {
    var ev = e || window.event; //获取event对象
    var obj = ev.target || ev.srcElement; //获取事件源
    var t = obj.type || obj.getAttribute('type'); //获取事件源类型
    //获取作为判断条件的事件类型
    var vReadOnly = obj.readOnly;
    var vDisabled = obj.disabled;
    //处理undefined值情况
    vReadOnly = (vReadOnly == undefined) ? false : vReadOnly;
    vDisabled = (vDisabled == undefined) ? true : vDisabled;
    //当敲Backspace键时，事件源类型为密码或单行、多行文本的，
    //并且readOnly属性为true或disabled属性为true的，则退格键失效
    var flag1 = ev.keyCode == 8 && (t == "password" || t == "text" || t == "textarea" || t == "number") && (vReadOnly == true || vDisabled == true);
    //当敲Backspace键时，事件源类型非密码或单行、多行文本的，则退格键失效
    var flag2 = ev.keyCode == 8 && !(t == "password" || t == "text" || t == "textarea" || t == "number");
    //判断
    if (flag2 || flag1) {
        return false;
    }
}

//禁止后退键 作用于Firefox、Opera
document.onkeypress = forbidBackSpace;
//禁止后退键  作用于IE、Chrome
document.onkeydown = forbidBackSpace;